<?php

namespace Kateba\RestaurantBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Kateba\RestaurantBundle\Entity\Category;

/**
 * Category controller.
 *
 */
class CategoryController extends Controller {

    /**
     * Lists all Category entities.
     *
     */
    public function indexAction() {
        $em = $this->getDoctrine()->getEntityManager();

        $entities = $em->getRepository('KatebaRestaurantBundle:Category')->findAll();

        return $this->render('KatebaRestaurantBundle:Category:index.html.twig', array(
                    'entities' => $entities
                ));
    }

    /**
     * Finds and displays a Category entity.
     *
     */
    public function showAction($id) {
        $em = $this->getDoctrine()->getEntityManager();

        $entity = $em->getRepository('KatebaRestaurantBundle:Category')->find($id);

        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Category entity.');
        }

        return $this->render('KatebaRestaurantBundle:Category:show.html.twig', array(
                    'entity' => $entity,
                ));
    }

}
